const Router=require('koa-router');
const authorfoot=new Router(); 
const sqldata=require('../sqldata')
//查询诗人
authorfoot.get('/',async(ctx)=>{
    let val=ctx.request.query
    let sql=`select * from authorfoot where aname like '%${val.aname}%'`
    let mydata = await new Promise((resolve, reject)=>{
      return sqldata(sql, (err, data)=>{
          if(err) reject(err);
          resolve(data);	// 返回拿到的数据
      })
    })
    ctx.body=mydata;
})
//诗人足迹详情
authorfoot.get('/detail',async(ctx)=>{
    let val=ctx.request.query
    let sql=`select * from authorfoot where aid=${val.aid}`
    let mydata = await new Promise((resolve, reject)=>{
      return sqldata(sql, (err, data)=>{
          if(err) reject(err);
          resolve(data);	// 返回拿到的数据
      })
    })
    ctx.body=mydata;
})
module.exports=authorfoot;